import Vue from 'vue'
import App from './App.vue'


// 注册全局组件
import TypeNav from '@/components/TypeNav'
import Carousel from '@/components/Carousel'
import Pagination from '@/components/Pagination'
import { Button, Loading, MessageBox } from 'element-ui'

Vue.component(TypeNav.name, TypeNav)
Vue.component(Carousel.name, Carousel)
Vue.component(Pagination.name, Pagination)

Vue.component(Button.name, Button)
// 挂载在原型上
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

import router from '@/router'
Vue.config.productionTip = false
import store from '@/store'
import '@/mock/mockServe'
import 'swiper/css/swiper.css'
//引入表单校验插件
import "@/plugins/validate"
// 统一引入api接口
import * as API from '@/api'

// 引入图片懒加载插件
import VueLazyload from 'vue-lazyload'
import lan from '@/assets/images/lan.jpg'
import error from '@/assets/images/error.jpg'
Vue.use(VueLazyload, {
  // 懒加载默认图片
  loading: lan,
  attempt: 1,
  preLoad: 1.3,
  error: error
})


new Vue({
  render: h => h(App),
  // 配置全局事件总线 $bus
  beforeCreate() {
    Vue.prototype.$bus = this
    Vue.prototype.$API = API
  },
  router,
  store
}).$mount('#app')
